<?php 
use_stylesheet('list.css');
use_helper('toolsbar');
slot('Toolsbar');
   echo setToolbar('index','plant');
end_slot();


slot('PageTitle',"Plant");
slot('Title',"Plant Overview");

?>


<table id=lista>
  <thead>
    <tr>
      <th <?php if ($sf_user->getOrderField()=='name') echo 'class=order'?>><a href="<?php echo url_for('plant')."?orderBy=name"?>">Name</a></th>
     
      <th <?php if ($sf_user->getOrderField()=='location') echo 'class=order'?>><a href="<?php echo url_for('plant')."?orderBy=location"?>">Location</a></th>
      <th <?php if ($sf_user->getOrderField()=='Pm') echo 'class=order'?>><a href="<?php echo url_for('plant')."?orderBy=Pm"?>">Pm</a></th>
      <th <?php if ($sf_user->getOrderField()=='Pn') echo 'class=order'?>><a href="<?php echo url_for('plant')."?orderBy=Pn"?>">Pn</a></th>
      <th <?php if ($sf_user->getOrderField()=='internet') echo 'class=order'?>><a href="<?php echo url_for('plant')."?orderBy=internet"?>">ISP</a></th>
      <th> Maintainer </th>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($plants as $key=>$plant): $odd = fmod($key, 2) ? 'odd' : 'even'?>
    <tr class="<?php echo $odd ?>">
      <td><a href="<?php echo url_for('plant_show',$plant)?>"> <?php echo $plant->getName() ?></a></td>

      <td><?php echo $plant->getLocation()."(".$plant->getCity().")" ?></td>
      <td><?php echo $plant->getPM() ?></td>
      <td class="nowrap"><?php echo $plant->getPn() ?> kWp</td>
      <td><?php echo $plant->getInternet() ?></td>
      <td><?php if (!is_null($plant->getMaintainer())): ?>
                    <a href="<?php echo url_for('supplier_show',$plant->getMaintainer())?>"><?php $name=strlen($plant->getMaintainer())>15?substr($plant->getMaintainer(), 0, 15)." ..":$plant->getMaintainer(); echo $name  ?></td>
          <?php 
                else:
                    echo "-";
                endif?>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>
